Skip to main content

All Questions

Tagged with
2votes
2answers
69views

LFU cache in Kotlin

I've been working on the classic LFU (Least Frequently Used) cache running in O(1) time problem lately and, as a student, I kind of struggled with the algorithms I found online. I got most of the idea ...
NicolaM94's user avatar
0votes
1answer
151views

LeetCode - LRU Cache by rodde

I have solved this LeetCode problem. Depending (perhaps) on the server load, I once scored the following performance figures: My code follows: ...
coderodde's user avatar
1vote
2answers
439views

My LRU Cache implementation in Java

...
learner's user avatar
2votes
1answer
130views

Python: lru_cache make leetcode's dungeon game more slower

I'm trying to implement a recursive+momoize version for leetcode's dungeon game question. I tried to use @lru_cache(): ...
pvd's user avatar
  • 123
4votes
1answer
2kviews

Cache-optimized matrix multiplication algorithm in C

I am trying to optimize matrix multiplication on a single processor by optimizing cache use. I am implemented a block multiplication and used some loop unrolling, but I'm at a loss on how to optimize ...
qscott86's user avatar
2votes
2answers
2kviews

Simple implementation of LRU caching in PHP

This is my implementation of LRU caching in PHP. It works fine when I tested as. What are the things that I miss or need attention? ...
Shobi's user avatar
2votes
1answer
211views

Speeding up evaluation of power series, Python

I want to plot (on the complex plane, with mpmath) the power series whose general term is the number of partitions of an integer. The more points I want (and the ...
RUser4512's user avatar
0votes
1answer
2kviews

C# implementation of LRU-cache

I implemented a LRU-cache in C# and wanted to hear suggestions in making it more readable and maybe even more compact. ...
user2033412's user avatar
3votes
1answer
7kviews

LRU cache in Python

Here is my simple code for LRU cache in Python 2.7. Appreciate if anyone could review for logic correctness and also potential performance improvements. A confusion want to ask for advice is, I am ...
Lin Ma's user avatar
  • 3,493
9votes
2answers
22kviews

Caches implementation in C++

I had a test task for internship where the main part was in implementing fixed size caches with different displacement policies (LRU/LFU/FIFO). I did that task, but was refused afterwards. Now I am ...
vpetrigo's user avatar
4votes
0answers
358views

Cache with timeout per key

I wrote a general purpose library for in-memory cache with custom timeout for each key. ...
Alex Bar's user avatar
12votes
4answers
496views

I'm not sure if I still love Fibonacci, but my code is getting better. How much better?

Technically, this is a follow up to these two questions, but I have taken a radically different approach. Everybody Loves Fibonacci Does everyone still love Fibonacci I finally allowed myself to be ...
RubberDuck's user avatar
5votes
1answer
2kviews

Function to delete oldest items out of HTML5 localStorage. Can I make it more efficient?

In a current javascript project, I'm working with the browsers localStorage, and it will pretty consistently be full. To overcome this, I wrote a wrapper to surround the localStorage object that would ...
Nathan's user avatar
4votes
1answer
7kviews

Design LRU cache interview questions

Code reviewers, I request you review the code and suggest all tips for improvement. ...
JavaDeveloper's user avatar

close